<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">Shipmentid 不良申请</h3></div>
            <div class="panel-body">
                <form action="__URL__/shipmentIdRejects" method="get" onsubmit="return checkSave()">
                    <div class="container-fluid">
                        <!--<div class="col-sm-12 col-md-3 add-space">-->
                            <!--<div class="input-group input-group-md">-->
                                <!--<span class="input-group-addon">账号</span>-->
                                <!--<select  class="form-control chosen-select" tabindex="-1" name="account_id"-->
                                         <!--data-name-group="common">-->
                                    <!--<option value="" class="empty-opt">&#45;&#45; 请选择 &#45;&#45;</option>-->
                                    <!--<volist name="accounts" id="acc">-->
                                        <!--<option value="{$acc.id}">{$acc.name}</option>-->
                                    <!--</volist>-->
                                <!--</select>-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="col-sm-12 col-md-3 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">Shipmentid</span>
                                <input class="form-control" type="text" name="shipmentid" value="">
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-1 add-space">
                            <button type="submit" class="btn btn-info">查询</button>
                        </div>
                    </div>
                </form>
                <div class="clearfix"></div>
                <div style="color: red;margin-left: 10px;">
                    <b>
                        Shipmentid不良申请使用条件:<br>
                        1.不良申请时要确定亚马逊平台上的数据跟公司系统的一致，不良品返仓亚马逊平台上就要把对应SKU数量改正，良品返仓的话就要在亚马逊平台上对应sku数量改为0<br>
                        2.Shipmentid状态为待录入箱唛数据才能进行不良申请；<br>
                        3.由于sku中有某个产品不良了可以申请不良；
                    </b>
                </div>
                <hr>
                <form action="__URL__/shipmentIdRejectsSave" method="post">
                <table class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th>帐号</th>
                        <th>SKU</th>
                        <th>中文名称</th>
                        <th>总需求数</th>
                        <th>不良数量</th>
                        <th>是否退税</th>
                        <th>公司主体</th>
                        <!--<th>不良回库单ID</th>-->
                        <th>备注</th>
                        <!--<th>操作</th>-->
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="data" id="da">
                        <volist name="da.detail" id="vo" key="num">
                        <tr>
                            <td><input type="hidden" name="account_id[]" value="{$da.account_id}">{$da.account_name}</td>
                            <td><input type="hidden" name="sku[]" value="{$vo.sku}">{$vo.sku}</td>
                            <td><input type="hidden" name="sku_name[]" value="{$vo.sku_name}">{$vo.sku_name}</td>
                            <td><input type="hidden" name="old_quantity[]" value="{$vo.quantity}">{$vo.quantity}</td>
                            <td><input type="hidden" name="detail_id[]" value="{$vo.id}"><input class="form-control w50" type="text" name="quantity[]" value=""/></td>
                            <td><input type="hidden" name="export_tax_rebate[]" value="{$vo.export_tax_rebate}">{$vo.export_tax_rebate}</td>
                            <td><input type="hidden" name="enterprise_dominant[]" value="{$vo.enterprise_dominant}">{$vo.enterprise_dominant}</td>
                            <td><input class="form-control" type="text" name="remark[]" value=""/></td>
                            <!--<td><button type="button" class="btn btn-info btn-sm add-space">废除行</button></td>-->
                        </tr>
                        </volist>
                    </volist>
                </table>
                <div class="clearfix clear"></div>
                <div class="col-md-offset-5 col-md-6 add-space">
                    <input type="hidden" value="{$data.0.shipmentid}" name="shipmentid">
                    <input type="hidden" value="{$data.0.seller_id}" name="seller_id">
                    <input type="hidden" value="{$data.0.site_id}" name="site_id">
                    <input class="btn btn-primary" type="submit" value="申请">
                    <!--<input class="btn btn-default" type="button" onclick="save('{$data.0.shipmentid}')" value="Shipmentid 确认修改数量">-->
                </div>
                </form>
                <div class="clearfix"></div>
                <!--<form action="" method="get">-->
                    <!--<div class="container-fluid">-->
                        <!--<div class="col-sm-12 col-md-3 add-space">-->
                            <!--<div class="input-group input-group-md">-->
                                <!--<span class="input-group-addon">Shipmentid</span>-->
                                <!--<input class="form-control" type="text" value="">-->
                            <!--</div>-->
                        <!--</div>-->

                        <!--<div class="col-sm-12 col-md-1 add-space">-->
                            <!--<button type="button" class="btn btn-info">查询</button>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</form>-->
                <!--<div class="clearfix"></div>-->
                <!--<hr>-->
                <!--<table class="table table-striped  table-hover" cellspacing="0" width="100%">-->
                    <!--<thead>-->
                    <!--<tr>-->
                        <!--<th>SKU</th>-->
                        <!--<th>中文名称</th>-->
                        <!--<th>数量</th>-->
                        <!--<th>是否退税</th>-->
                        <!--<th>公司主体</th>-->
                        <!--<th>不良回库单ID</th>-->
                        <!--<th>备注</th>-->
                        <!--<th>操作</th>-->
                    <!--</tr>-->
                    <!--</thead>-->
                    <!--<tbody>-->
                    <!--<tr>-->
                        <!--&lt;!&ndash;<td class="text-center"><input name="subBox" type="checkbox" value="103"></td> &ndash;&gt;-->
                        <!--<td>Q124饿</td>-->
                        <!--<td>dafadadas</td>-->
                        <!--<td><input class="form-control w50" type="text" /></td>-->
                        <!--<td>是</td>-->
                        <!--<td>有棵树</td>-->
                        <!--<td><input class="form-control w80" type="text" /></td>-->
                        <!--<td><input class="form-control" type="text" /></td>-->
                        <!--<td><button type="button" class="btn btn-info btn-sm add-space">废除行</button></td>-->
                    <!--</tr>-->
                <!--</table>-->
                <!--<div class="clearfix clear"></div>-->
                <!--<div class="col-md-offset-4 col-md-6 add-space">-->
                    <!--<input class="btn btn-primary" type="submit" value="确认生成新的已拣货确认平台计划单">-->
                <!--</div>-->
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("input[name='shipmentid']").val("<?php  echo $_GET['shipmentid'];?>");
        $("select[name='account_id']").val("<?php  echo $_GET['account_id'];?>");
        $('select.chosen-select').chosen({
            no_results_text: '没有找到',    // 当检索时没有找到匹配项时显示的提示文本
            disable_search_threshold: 2, // 10 个以下的选择项则不显示检索框
            search_contains: true         // 从任意位置开始检索
        });

    });
    function checkSave() {
        if($("input[name='shipmentid']").val()==''){
            layer.msg('请输入shipmentid', {icon: 5});
            return false;
        }else{
            return true;
        }
    }
    function save(shipmentid) {
        $.ajax({
            url: "__URL__/checkPosition",
            type: 'post',
            async: false, //default: true
            data: {'shipmentid':shipmentid},
            dataType: 'json', // default: Intelligent Guess (xml, json, script, or html)
            success: function (data) {
                if ($.trim(data.status) == 200) {
                    flag = 'ok';
                }else{
                    layer.msg(data.msg, {icon: 5});
                    flag = 'no';
                }
            }
        });
    }
</script>